package org.loong.crypto.service.core.provider;

import org.loong.crypto.common.exception.CryptoException;
import org.loong.crypto.core.algorithm.MessageDigestAlgorithm;
import org.loong.crypto.core.params.MessageDigestParameters;

/**
 * MessageDigest.
 */
public interface MessageDigest extends MessageDigestProvider {

    /**
     * Initialise message digest.
     * 
     * @param parameters the message digest parameters.
     */
    default void init(MessageDigestParameters parameters) {
        
    }
    
    /**
     * Message digest.
     * 
     * @param algorithm the algorithm
     * @param data the data to digest
     * @return the digest value
     * @throws CryptoException the {@link CryptoException}
     */
    byte[] digest(MessageDigestAlgorithm algorithm, byte[] data) throws CryptoException;
}
